<!--河南星辰软件科技有限公司
@copyright Copyright (c) 2010~2022 All rights reserved.
-->
<template>
  <div class='app-container'>
    <el-form ref="form" :model="s_work_position" :rules="rules" label-width="100px" id="mvcfm">
      <div class="form-unit">
        <span class="mvc-title-left"> 增加工位 </span>
      </div>
      <div>
        <el-row>
          <el-col :span="24">
            <el-form-item label="工位名称" prop="position_name">
              {{s_work_position.position_name}}
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item label="工位工序" prop="">
              {{s_work_position.process_name}}
            </el-form-item>
          </el-col>
        </el-row>
      </div>
      <div class="form-unit">
        <span class="mvc-title-left"> 工位设备 </span>
      </div>
      <el-table :data="s_work_position_device">
        <el-table-column label="设备名称" prop="produce_name">
        </el-table-column>
        <el-table-column label="设备型号" prop="produce_model">
        </el-table-column>
        <el-table-column label="设备规格" prop="produce_norm">
        </el-table-column>
        <el-table-column label="制造商名称" prop="produce_makename">
        </el-table-column>
        <el-table-column label="制造商联系人" prop="produce_makecontact">
        </el-table-column>
        <el-table-column label="制造商联系电话" prop="produce_maketel">
        </el-table-column>
      </el-table>
      <div class="form-unit">
        <span class="mvc-title-left"> 工位人员 </span>
      </div>
      <el-table :data="s_work_person">
        <el-table-column label="人员名称" prop="person_name">
        </el-table-column>
        <el-table-column label="人员岗位" prop="role">
        </el-table-column>
      </el-table>
      <div class="form-unit">
        <span class="mvc-title-left"> 原材料 </span>
      </div>
      <el-table :data="s_stuff">
        <el-table-column label="产品条形码" prop="product_barcode">
        </el-table-column>
        <el-table-column label="产品名称" prop="product_name">
        </el-table-column>
        <el-table-column label="产品描述" prop="product_des">
        </el-table-column>
        <el-table-column label="产品价格" prop="product_price">
        </el-table-column>
      </el-table>
      <div class="form-unit">
        <span class="mvc-title-left"> 填写工作能力 </span>
      </div>
      <div>
        <el-row>
          <el-col :span="12">
            <el-form-item label="工作能力" prop="position_able_des">
              <el-input v-model="s_able.position_able_des" />
            </el-form-item>
          </el-col>
        </el-row>
      </div>
      <el-button @click="stationAbilitySubmit('')" type='success' size="mini"><i class='fa fa-check'></i>保存</el-button>
      <el-button @click="gotoPage('/mes/produce/StationList?'+vueparams+'')" type='primary' size="mini"><i class='fa fa-reply'></i>返回</el-button>
    </el-form>
  </div>
</template>
<script>
  import request from '@/utils/request'
  export default {
    name: 'StationAbility',
    components: {},
    props: ['popparams'],
    data() {
      return {
        vueparams: this.getVUEParams(""),
        s_work_position: {
          position_name: null,
          process_name: null,
        },
        s_work_position_device: [],
        s_work_person: [],
        s_stuff: [],
        s_able: {
          position_able_des: null,
        },
        loading: false,
        rules: {}
      }
    },
    created() {
      this.getData();
    },
    updated() {},
    mounted() {},
    methods: {
      getData() {
        request({
          method: 'get',
          url: '/xcapi/VUEAction/mes/produce/MftResourceAction/stationAbility?' + this.vueparams,
        }).then(data => {
          for (var k in data) {
            if (Array.isArray(data[k])) {
              this[k] = data[k];
            } else {
              $.extend(this[k], data[k]);
            }
          }
        })
      },
      stationAbilitySubmit(_params) {
        this.$refs["form"].validate(valid => {
          if (valid) {
            request({
              method: 'post',
              url: '/xcapi/VUEAction/mes/produce/MftResourceAction/stationAbilitySubmit?' + _params + this.vueparams,
              data: this.postData()
            }).then(data => {
              this.gotoPage("/mes/produce/StationList/stationList?" + this.vueparams, data);
              this.msgSuccess(data.msg);
            })
          } else {
            this.msgError("必填项错误");
          }
        });
      },
    },
  }
</script>
